home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-06-01 | 1.9 KB | 69 lines | [TEXT/GEOL] |
- Item 8208550 31-May-90 00:30PDT
-
- From: D5000 Succession, Eric Brewer,PRT
-
- To: MACDTS Macintosh Developer Tech Supt
- CPLUS.APPLE$ C++ Interest List--Apple Employees
- CPLUS.DEV$ C++ Interest List--Developers
-
- Sub: C++ Library bug
-
- Hi,
-
- The following code demonstrates a bug with the C++ runtime library for 3.1b1
- version of the C++ compiler.
- #include <FStream.h>
- #include <IOManip.h>
- #include <IOStream.h>
- #include <StdIO.h>
- #include <StdLib.h>
-
-
- main(int argc, char *argv[])
- {
- if (argc < 2)
- {
- cerr << "Usage: " << argv[0] << " input_file" << endl;
- exit (1);
- }
-
-
- ifstream input (argv[1]);
- if (!input)
- {
- cerr << "Could not open " << argv[1] << " for input." << endl;
- exit (1);
- }
-
-
- char line[256];
- while (input.good ())
- {
- input.getline (line, sizeof line);
- cout << "Line is '" << line << "'" << endl;
- }
- }
- The above code should copy every line of a given file to stdout with the string
- "Line is'" preceding each line, and "'" terminating each line. This happens
- correctly as long as the file ends with a newline. If a file does not end with
- a newline, the last line will not be output (e.g. lost).
-
- I compiled and linked the file with the following commands:
- CPlus Bug.cp -o Bug.cp.o -i {Boot}MPW:Interfaces:CIncludes:
- Delete -i f
- Link Bug.cp.o -o Bug ∂
- -c "Eric" -t "MPST" ∂
- "{CLibraries}"CPlusLib.o ∂
- "{CLibraries}"CRuntime.o ∂
- "{CLibraries}"StdCLib.o ∂
- "{CLibraries}"CInterface.o ∂
- "{Libraries}"Interface.o
-
- Has anyone else run into this problem? Is there a reasonable work around?
-
-
- Thanks,
- Eric T. Brewer
- D5000
-
-